<admintpl file="header" />
</head>
<body>
<div class="wrap">
    <ul class="nav nav-tabs">
        <li class="active"><a>推荐人列表</a></li>
    </ul>
    <form class="well form-search" id="searchForm" method="post" action="{:U('Runmenanalysis/recom_analysis_list')}">

        类别:
        <select class="select_2" id="recommended_type" name="formget[recommended_type]" style="width: 65px;" >
            <option value='0' {$formget[recommended_type]==0?selected:''}>全部</option>
            <option value='1' {$formget[recommended_type]==1?selected:''}>用户</option>
            <option value='2' {$formget[recommended_type]==2?selected:''}>跑客</option>
        </select>
        姓名:<input type="text" id="recommended_name" name="formget[recommended_name]" style="width: 90px;" value="{$formget.recommended_name}">
        电话:<input type="text" id="recommended_mobile" name="formget[recommended_mobile]" style="width: 90px;" value="{$formget.recommended_mobile}">
        推荐人类别:
        <select class="select_2" id="recom_type" name="formget[recom_type]" style="width: 65px;" >
            <option value='0' {$formget[recom_type]==0?selected:''}>全部</option>
            <option value='1' {$formget[recom_type]==1?selected:''}>用户</option>
            <option value='2' {$formget[recom_type]==2?selected:''}>跑客</option>
        </select>
       推荐人姓名：<input type="text" id="recom_name" name="formget[recom_name]" style="width: 90px;" value="{$formget.recom_name}">
        推荐人 电话:<input type="text" id="recom_mobile" name="formget[recom_mobile]" style="width: 90px;" value="{$formget.recom_mobile}">
        <label class="control-label">推荐时间</label>
        <input type="text" class="js-date" name="formget[start_time]" value="{$formget.start_time}" style="width: 80px;" autocomplete="off">-
        <input type="text" class="js-date" name="formget[end_time]" value="{$formget.end_time}" style="width: 80px;" autocomplete="off">

        &nbsp;&nbsp;
        <input type="button" class="btn btn-primary" value="搜索" onclick="validatePrarm()"/>
    </form>

        总数：{$total_count}人
    <form method="post" class="js-ajax-form">
        <table class="table table-hover table-bordered">
            <thead>
            <tr>
                <th width="15"><label><input type="checkbox" class="js-check-all" data-direction="x" data-checklist="js-check-x"></label></th>
                <th align="center">序号</th>
                <th>类别</th>
                <th>姓名</th>
                <th>电话</th>
                <!--<th>归属地</th>-->
                <th>推荐人类型</th>
                <th>推荐人姓名</th>
                <th>推荐人电话</th>
                <th>注册时间</th>
                <th>一级用户数</th>
                <th>一级跑客数</th>
                <th>关系用户数</th>
            </tr>
            </thead>
            <tbody>
            <php>$coupon_types=array("1"=>"用户","2"=>"跑客");
                $recommended_statuses=array("0"=>"未激活","1"=>"已激活");
            </php>
            <foreach name="datas" item="vo" key="k">
                <tr>
                    <td><input type="checkbox" class="js-check" data-yid="js-check-y" data-xid="js-check-x" name="ids[]" value="{$vo.recommend_id}" title="ID:{$vo.recommend_id}"></td>
                    <td align="center">{$k+1}</td>
                    <td align="center">{$coupon_types[$vo['recommended_person_type']]}</td>
                    <td align="center">{$vo.recommend_name}</td>
                    <td align="center">{$vo.recommend_mobile}</td>
                    <!--<td align="center">{$vo.recommend_mobile_place}</td>-->
                    <td align="center">{$coupon_types[$vo['recom_person_type']]}</td>
                    <td align="center">{$vo.recom_name}</td>
                    <td align="center">{$vo.recom_mobile}</td>
                    <td align="center">{$vo.recommended_time}</td>


                    <td align="center">{$vo['recommended_person_id']|get_recom_pn_count=$vo['recommended_person_type']}</td>
                    <td align="center">{$vo['recommended_person_id']|get_recom_user_count=$vo['recommended_person_type']}</td>
                    <td align="center">
                        {$vo['recommended_person_id']|get_recom_count=$vo['recommended_person_type']}
                    </td>
                </tr>
                
            </foreach>
            </tbody>
        </table>
        <if condition="empty($datas)">
            <div style="padding: 30px;text-align: center;color: #999999">
                <i class="fa fa-database" style="font-size: 38px"></i><br />
                暂无数据
            </div>
        </if>
        <div class="pagination">{$page}</div>
    </form>
</div>
<script src="__PUBLIC__/js/common.js"></script>
<script type="text/javascript">

    function validatePrarm() {


        var recommended_name = $("#recommended_name").val();
        var recommended_mobile = $("#recommended_mobile").val();
        var recommended_type = $("#recommended_type").val();

        var recom_type = $("#recom_type").val();
        var recom_name = $("#recom_name").val();
        var recom_mobile = $("#recom_mobile").val();
        //alert(recom_name);
        //从被推荐人开始判断
        if (recommended_name != "" && recommended_name != 'undefined') {
            if (recommended_type == "" || recommended_type == "undefined" || recommended_type == '0') {
                layer.alert('请选择类别');
                return;
            } else {
                if (recom_mobile != "" && recom_mobile != 'undefined') {
                    if (recom_type == "" || recom_type == "undefined" || recom_type == '0') {
                        layer.alert('请输入推荐人类别');
                        return;
                    } else if (recom_name != "" && recom_name != 'undefined') {
                        if (recom_type == "" || recom_type == "undefined" || recom_type == '0') {
                            layer.alert('请输入推荐人类别');
                            return;
                        }else
                            document.getElementById("searchForm").submit();
                    }else
                        document.getElementById("searchForm").submit();
                }else if( recom_name  != "" && recom_name != 'undefined'){
                    if (recom_type == "" || recom_type == "undefined" || recom_type == '0') {
                        layer.alert('请输入推荐人类别');
                        return;
                    } else if (recom_mobile != "" && recom_mobile != 'undefined') {
                        if (recom_type == "" || recom_type == "undefined" || recom_type == '0') {
                            layer.alert('请输入推荐人类别');
                            return;
                        }else
                            document.getElementById("searchForm").submit();
                    }else
                        document.getElementById("searchForm").submit();
                }else
                    document.getElementById("searchForm").submit();
            }
        } else if (recommended_mobile != "" && recommended_mobile != 'undefined') {
            if (recommended_type == "" || recommended_type == "undefined" || recommended_type == '0') {
                layer.alert('请选择类别');
                return;
            } else {
                if (recom_mobile != "" && recom_mobile != 'undefined') {
                    if (recom_type == "" || recom_type == "undefined" || recom_type == '0') {
                        layer.alert('请输入推荐人类别');
                        return;
                    } else if (recom_name != "" && recom_name != 'undefined') {
                        if (recom_type == "" || recom_type == "undefined" || recom_type == '0') {
                            layer.alert('请输入推荐人类别');
                            return;
                        }else
                            document.getElementById("searchForm").submit();
                    }else
                        document.getElementById("searchForm").submit();
                }else if( recom_name  != "" && recom_name != 'undefined'){
                    if (recom_type == "" || recom_type == "undefined" || recom_type == '0') {
                        layer.alert('请输入推荐人类别');
                        return;
                    } else if (recom_mobile != "" && recom_mobile != 'undefined') {
                        if (recom_type == "" || recom_type == "undefined" || recom_type == '0') {
                            layer.alert('请输入推荐人类别');
                            return;
                        }else
                            document.getElementById("searchForm").submit();
                    }else
                        document.getElementById("searchForm").submit();
                }else
                    document.getElementById("searchForm").submit();
            }
        }

        //从推荐人开始判断
        if (recom_name != "" && recom_name != 'undefined') {

            if (recom_type == "" || recom_type == "undefined" || recom_type == 0) {
                layer.alert('请选择推荐人类别');
                return;
            } else {
                if (recommended_mobile != "" && recommended_mobile != 'undefined') {
                    if (recommended_type == "" || recommended_type == "undefined" || recommended_type == '0') {
                        layer.alert('请输入类别');
                        return;
                    } else if (recommended_name != "" && recommended_name != 'undefined') {
                        if (recommended_type == "" || recommended_type == "undefined" || recom_type == '0') {
                            layer.alert('请输入类别');
                            return;
                        }else
                            document.getElementById("searchForm").submit();
                    }else
                        document.getElementById("searchForm").submit();
                }else if( recommended_name  != "" && recommended_name != 'undefined'){
                    if (recommended_type == "" || recommended_type == "undefined" || recommended_type == '0') {
                        layer.alert('请输入类别');
                        return;
                    } else if (recommended_mobile != "" && recommended_mobile != 'undefined') {
                        if (recommended_type == "" || recommended_type == "undefined" || recommended_type == '0') {
                            layer.alert('请输入类别');
                            return;
                        }else
                            document.getElementById("searchForm").submit();
                    }else
                        document.getElementById("searchForm").submit();
                }else
                    document.getElementById("searchForm").submit();
            }
        } else if (recom_mobile != "" && recom_mobile != 'undefined') {
            if (recom_type == "" || recom_type == "undefined" || recom_type == '0') {
                layer.alert('请选择推荐人类别');
                return;
            } else {
                if (recommended_mobile != "" && recommended_mobile != 'undefined') {
                    if (recommended_type == "" || recommended_type == "undefined" || recommended_type == '0') {
                        layer.alert('请输入类别');
                        return;
                    } else if (recommended_name != "" && recommended_name != 'undefined') {
                        if (recommended_type == "" || recommended_type == "undefined" || recom_type == '0') {
                            layer.alert('请输入类别');
                            return;
                        }else
                            document.getElementById("searchForm").submit();
                    }else if( recommended_mobile  != "" && recommended_mobile != 'undefined'){
                        if (recommended_type == "" || recommended_type == "undefined" || recommended_type == '0') {
                            layer.alert('请输入类别');
                            return;
                        } else if (recommended_name != "" && recommended_name != 'undefined') {
                            if (recommended_type == "" || recommended_type == "undefined" || recommended_type == '0') {
                                layer.alert('请输入类别');
                                return;
                            }else
                                document.getElementById("searchForm").submit();
                        }else
                            document.getElementById("searchForm").submit();
                    }else
                        document.getElementById("searchForm").submit();
                }else
                    document.getElementById("searchForm").submit();
            }
        }else
            document.getElementById("searchForm").submit();

    }
</script>
</body>
</html>